var express = require('express');
var router = express.Router();
const { getTenants, getAuditTenants, updateAuditTenants, getTenantsById
    , changeTenantsById } = require('../service/tenantsService');

//获取，查询所有已审核租客
router.get('/getTenants', async function (req, res, next) {
    const data = await getTenants(req.query);
    res.send(data);
});
//获取所有未审核租客
router.get('/getAuditTenants', async function (req, res, next) {
    const data = await getAuditTenants(req.query);
    res.send(data);
});
//获取要修改的未审核租客
router.post('/updateAuditTenants', async function (req, res, next) {
    const { _id } = req.body;
    const data = await updateAuditTenants({ _id })
    res.send(data);
});

//通过id获取租客信息
router.post('/getTenantsById', async function (req, res, next) {
    const data = await getTenantsById(req.body);
    res.send(data);
});


//通过id修改租客的信息
router.post('/changeTenantsById', async function (req, res, next) {
    const data = await changeTenantsById(req.body);
    res.send(data);
});
module.exports = router;
